box: Use widget children list in count_expand_children
authorTimm Bäder <mail@baedert.org>
Tue, 23 May 2017 13:05:32 +0000 (15:05 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:13 +0000 (21:27 -0400)
It's still less dereferencing than the previous code.

gtk/gtkbox.c

index ec21d9712f5da1c0cee5284069ea3a471f1e3884..312f5357823e4dd5f28e17676aa8353954110abd 100644 (file)
@@ -332,21 +332,21 @@ count_expand_children (GtkBox *box,
                        gint *expand_children)
 {
   GtkBoxPrivate  *private = box->priv;
-  GList       *children;
-  GtkBoxChild *child;
+  GtkWidget *child;
 
   *visible_children = *expand_children = 0;
 
-  for (children = private->children; children; children = children->next)
+  for (child = _gtk_widget_get_first_child (GTK_WIDGET (box));
+       child != NULL;
+       child = _gtk_widget_get_next_sibling (child))
     {
-      child = children->data;
+      if (_gtk_widget_get_visible (child))
+        {
+          *visible_children += 1;
 
-      if (_gtk_widget_get_visible (child->widget))
-       {
-         *visible_children += 1;
-          if (gtk_widget_compute_expand (child->widget, private->orientation))
-           *expand_children += 1;
-       }
+          if (gtk_widget_compute_expand (child, private->orientation))
+            *expand_children += 1;
+        }
     }
 }